package org.sczfdf.conf;

import org.sczfdf.utils.PropertiesUtil;

import static org.sczfdf.constants.Constant.MAIL_RECEIVE_MAIL_ACCOUNT;
import static org.sczfdf.constants.Constant.MAIL_SEND_INTERVAL;
import static org.sczfdf.constants.Constant.MAIL_SEND_MAIL_ACCOUNT;
import static org.sczfdf.constants.Constant.MAIL_SEND_MAIL_AUTH;
import static org.sczfdf.constants.Constant.MAIL_SMTP_HOST;
import static org.sczfdf.constants.Constant.MAIL_SMTP_PORT;

/**
 * @author Created by cgb
 * @date 2023/1/31
 */
public class MailConf {
    private static final MailConf MAIL_CONF = new MailConf();;
    public static MailConf get() {
        return MAIL_CONF;
    }
    /**
     * 邮件服务器的Host
     * <p>默认网易邮箱
     */
    private String smtpHost;
    /**
     * 邮件服务器的端口
     * <p>默认25
     */
    private Integer smtpPort;

    /**
     * 发件的邮箱账号
     */
    private String sendMailAccount;
    /**
     * 发件邮箱的秘钥
     */
    private String sendMailAuth;

    /**
     * 收件的邮箱账号
     */
    private String receiveMailAccount;

    /**
     * 发送邮件间隔
     */
    private Integer sendInterval;

    private MailConf() {
        smtpHost = PropertiesUtil.getConf(MAIL_SMTP_HOST);
        smtpPort = Integer.valueOf(PropertiesUtil.getConf(MAIL_SMTP_PORT));
        sendMailAccount = PropertiesUtil.getConf(MAIL_SEND_MAIL_ACCOUNT);
        sendMailAuth = PropertiesUtil.getConf(MAIL_SEND_MAIL_AUTH);
        receiveMailAccount = PropertiesUtil.getConf(MAIL_RECEIVE_MAIL_ACCOUNT);
        sendInterval = Integer.valueOf(PropertiesUtil.getConf(MAIL_SEND_INTERVAL));
    }


    public String getSmtpHost() {
        return smtpHost;
    }

    public void setSmtpHost(String smtpHost) {
        this.smtpHost = smtpHost;
    }

    public Integer getSmtpPort() {
        return smtpPort;
    }

    public void setSmtpPort(Integer smtpPort) {
        this.smtpPort = smtpPort;
    }

    public String getSendMailAccount() {
        return sendMailAccount;
    }

    public void setSendMailAccount(String sendMailAccount) {
        this.sendMailAccount = sendMailAccount;
    }

    public String getSendMailAuth() {
        return sendMailAuth;
    }

    public void setSendMailAuth(String sendMailAuth) {
        this.sendMailAuth = sendMailAuth;
    }

    public String getReceiveMailAccount() {
        return receiveMailAccount;
    }

    public void setReceiveMailAccount(String receiveMailAccount) {
        this.receiveMailAccount = receiveMailAccount;
    }

    public Integer getSendInterval() {
        return sendInterval;
    }

    public void setSendInterval(Integer sendInterval) {
        this.sendInterval = sendInterval;
    }
}
